package org.iabako.shared.querydefinition.columndefinition;

import org.iabako.client.tools.Messages;
import org.iabako.shared.querydefinition.dto.QueryResultValueType;

import java.io.Serializable;

/**
 * Created by jose on 04/11/14.
 */
public enum ExpenseColumnEnum implements ColumnDefinition, Serializable {
    number("expense.number", "result_table_expense_number", "columnSminus columnleftalign smalltable", null, null, QueryResultValueType.STRING, 4000, false),
    expenseType("expense.expenseType", "result_table_expense_type", "columnSminus smalltable", null, null, QueryResultValueType.STRING, 4000, false),
    category("expense.category", "result_table_expense_category", "columnM", null, null, QueryResultValueType.STRING, 6000, false),
    paymentDate("expense.paymentDate", "result_table_expense_payment_date", "columnS", null, null, QueryResultValueType.STRING, 4000, false),
    paymentMethod("expense.paymentMethod", "result_table_expense_payment_method", "columnS smalltable", null, null, QueryResultValueType.STRING, 6000, false),
    paymentValue("expense.paymentValue", "result_table_expense_payment_value", "columnSminus", null, null, QueryResultValueType.STRING, 4000, false),
    tax("expense.taxPercent", "result_table_product_tax", "", null, null, QueryResultValueType.DOUBLE, 4000, true),
    description("expense.description", "result_table_expense_description", "columnSextraminus columncenteralign", "commenticoncenter", "commenticonemptycenter", QueryResultValueType.ICON, 10000, false),
    status(null, "result_table_expense_status", "columnSextraminus columncenteralign", null, null, QueryResultValueType.ENUM, 4000, false),

    //Total calculation
    expenseTotal("sum(expense.paymentValue)", null, null, null, null, null, 0, false),
    //default filter with user session
    expenseEnterprise("expense.enterprise", null, null, null, null, null, 0, false),
    //To filter in tracking
    expenseId("expense.id", null, null, null, null, null, 0, false);

    private String hqlDefinition;
    private String labelKey;
    private String className;
    private String iconClassName;
    private String iconClassNameEmpty;
    private QueryResultValueType queryResultValueType;
    private int excelColumnWidth;
    private boolean onlyInExcelExport;

    ExpenseColumnEnum(String hqlDefinition, String labelKey, String className, String iconClassName,
                      String iconClassNameEmpty, QueryResultValueType queryResultValueType, int excelColumnWidth, boolean onlyInExcelExport) {
        this.hqlDefinition = hqlDefinition;
        this.labelKey = labelKey;
        this.className = className;
        this.iconClassName = iconClassName;
        this.iconClassNameEmpty = iconClassNameEmpty;
        this.queryResultValueType = queryResultValueType;
        this.excelColumnWidth = excelColumnWidth;
        this.onlyInExcelExport = onlyInExcelExport;
    }

    public String getHqlDefinition() {
        return hqlDefinition;
    }

    public String getHqlJoin() {
        return null;
    }


    public String getLabel() {
        return Messages.getLabel(labelKey);
    }

    public String getLabelKey() {
        return labelKey;
    }

    public QueryResultValueType getQueryResultValueType() {
        return queryResultValueType;
    }

    public int getExcelColumnWidth() {
        return excelColumnWidth;
    }

    public String getClassName() {
        return className;
    }

    public String getIconClassName() {
        return iconClassName;
    }

    public boolean isOnlyInExcelExport() {
        return onlyInExcelExport;
    }

    public String getIconClassNameEmpty() {
        return iconClassNameEmpty;
    }

    public String getTextEmpty() {
        return null;
    }
}
